package ioc18;

import java.beans.PropertyEditorSupport;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateEditor extends PropertyEditorSupport {

    @Override
    public void setAsText(String text) throws IllegalArgumentException {

        try {
            Date date=new SimpleDateFormat("yyyy-MM-dd").parse(text);

            setValue(date);
        } catch (ParseException e) {
            throw new IllegalArgumentException(e);
        }
    }
}
